function validate_required(field,alerttxt)
{
    with (field)
    {
        if (value==null||value=="")
          {alert(alerttxt);return false;}
        else {return true}
    }
}

function validate_postcomment(thisform)
{
    with (thisform)
    {
        message.value = tinyMCE.get('message').getContent()
        if (validate_required(message,"Reply must be filled out!")==false)
          {message.focus();return false;}
        if (message.value.length > 8000)
          {
              alert("Reply must be less than 8000 characters!");
              message.focus();
              return false;
          }
    }
}

function validate_posttopic(thisform)
{
    with (thisform)
    {
        message.value = tinyMCE.get('message').getContent()
        if (validate_required(title,"Title must be filled out!")==false)
          {title.focus();return false;}
        if (validate_required(message,"Message must be filled out!")==false)
          {message.focus();return false;}
        if (title.value.length > 200)
          {
              alert("Title must be less than 200 characters!");
              title.focus();
              return false;
          }
        if (message.value.length > 8000)
          {
              alert("Reply must be less than 8000 characters!");
              message.focus();
              return false;
          }
    }
}


function validate_postdocument(thisform)
{
    with (thisform)
    {
        if (validate_required(title,"Title must be filled out!")==false)
          {title.focus();return false;}
        if (title.value.length > 200)
          {
              alert("Title must be less than 200 characters!");
              title.focus();
              return false;
          }
        if (validate_required(summary,"Summary must be filled out!")==false)
          {summary.focus();return false;}
        if (summary.value.length > 499)
          {
              alert("Summary must be less than 500 characters!");
              summary.focus();
              return false;
          }
        if (validate_required(location,"Document URL must be filled out!")==false)
          {location.focus();return false;}
        if (validate_required(pages,"Page count must be filled out!")==false)
          {pages.focus();return false;}
        if (validate_required(categories,"At least one category must be selected!")==false)
          {categories.focus();return false;}
    }
}

function validate_postdiscussion(thisform)
{
    with (thisform)
    {
        if (validate_required(title,"Title must be filled out!")==false)
          {title.focus();return false;}
        if (title.value.length > 200)
          {
              alert("Title must be less than 200 characters!");
              title.focus();
              return false;
          }
        if (validate_required(description,"Description must be filled out!")==false)
          {summary.focus();return false;}
    }
}

function validate_postmessage(thisform)
{
    with (thisform)
    {
        if (validate_required(title,"Title must be filled out!")==false)
          {title.focus();return false;}
        if (validate_required(message,"Message must be filled out!")==false)
          {message.focus();return false;}
    }
}